package com.baomidou.springboot.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.springboot.bean.BaseController;
import com.baomidou.springboot.result.JsonResult;
import com.example.entity.B_file;
import com.example.service.IB_fileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

/**
 * <p>
 * 文件表 前端控制器
 * </p>
 *
 * @author funkye
 * @since 2019-03-20
 */
@RestController
@RequestMapping("/b_file")
@Api(tags = "文件接口")
public class B_fileController extends BaseController {
	@Autowired
	private IB_fileService fileService;
	private final static Logger logger = LoggerFactory.getLogger(B_fileController.class);

	@GetMapping(value = "findBannerPage")
	@ApiOperation(value = "查找Banner接口")
	public JsonResult findBannerPage(
			@ApiParam(name = "start", value = "起始页数", required = true) @RequestParam Integer start,
			@ApiParam(name = "size", value = "所需条数", required = true) @RequestParam Integer size) {
		if (size > 20) {
			size = 20;
		}
		B_file b = new B_file();
	//	b.setCategory("banner");
		IPage<B_file> page = fileService.page(start, size, "sort", false, b, "id", "link", "url");
		return renderSuccess(page);
	}

}
